<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition template="/WEB-INF/templates/basicTemplate.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:p="http://primefaces.org/ui">
	<ui:define name="content">
		<f:event type="preRenderView" listener="#{homePortaleBean.doOnLoad()}" />
			<div style="clear: both; padding: 10px;">
			
			<p:commandButton type="button" value="Inserisci Nuovo Utente" onclick="PF('dlg3').show();"
					id="buttonInserisciModal" action="#{homePortaleBean.inserisciUtente}" icon="ui-icon-plusthick" />
				
				<ui:include src="inserisciUtenteSnippet.xhtml" />
					
			</div>
			
			<p:commandButton id="imageBtn" value="Basic" type="button" />
				<p:overlayPanel id="imagePanel" for="imageBtn" hideEffect="fade">
					<h:outputText value="Benvenuti nel Manager del Reporting4.0!" /><br/><br/>		    	
	   	
				   	<p:outputLabel for="username" value="Username:" />
				   	<p:inputText id="username" value="#{homePortaleBean.username}" label="usermane"/>
				   	
				   	<p:outputLabel for="password" value="Password:" />
				   	<p:inputText id="password" value="#{homePortaleBean.password}" label="password"/>
				</p:overlayPanel>
			
			<ui:include src="filtriSnippet.xhtml" />
			<div id="panelResultDiv">
				<p:panel id="panelResult">

					<h:commandLink>
						<p:graphicImage value="/images/excel.png" />
						<p:dataExporter type="xls" target="dataList" fileName="xls" />
					</h:commandLink>

					<h:commandLink>
						<p:graphicImage value="/images/pdf.png" />
						<p:dataExporter type="pdf" target="dataList" fileName="pdf" />
					</h:commandLink>

					<h:commandLink>
						<p:graphicImage value="/images/csv.png" />
						<p:dataExporter type="csv" target="dataList" fileName="csv" />
					</h:commandLink>

					<h:commandLink>
						<p:graphicImage value="/images/xml.png" />
						<p:dataExporter type="xml" target="dataList" fileName="xml" />
					</h:commandLink>


					<p:dataTable var="item" value="#{homePortaleBean.list}" id="dataList"
						paginator="true" rows="15" rowsPerPageTemplate="10,25,50">
						<p:column sortBy="userId" style="text-align: center;"
							headerText="User ID">

							<p:commandLink id="buttonCodRichiesta"
								action="#{homePortaleBean.vaiDettaglio(item)}" ajax="false">
								<h:outputText value="#{item.userId}" />
							</p:commandLink>
						</p:column>
						<p:column sortBy="username" headerText="Username" style="text-align: center;">
							<h:outputText value="#{item.username}" />
						</p:column>
						<p:column sortBy="dataCreazione" headerText="Data Creazione" style="text-align: center;">
							<h:outputText value="#{item.dataCreazione}">
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>
						<p:column sortBy="dataUltMod" headerText="Data Ultima Modifica" style="text-align: center;">
							<h:outputText value="#{item.dataUltMod}">
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>
						<ui:remove>
							<p:column sortBy="query" headerText="Query">
								<h:outputText value="#{item.utente}" />
							</p:column>
							<p:column sortBy="richiedente" headerText="Laboratorio">
								<h:outputText value="#{item.laboratorio}" />
							</p:column>
						</ui:remove>
					</p:dataTable>
				</p:panel>
			</div>
	</ui:define>
</ui:composition>
